<?php
$this->headTitle($this->T('My Posts'));

/*
$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->setNamespace('post');
$Message = implode('<br />', $flashMessenger->getMessages());
$this->placeholder('flash_message')->set($this->E($Message));
*/
?>

<div>
    <h2><?php echo $this->link($this->U('post', 'edit'), $this->T('New Post')); ?></h2>
</div>

<div class="cl" style="height:25px;">&nbsp;</div>

<div>
    <?php
    if (!empty($this->posts)) {
    ?>
        <div class="post_list">

            <table width="100%" border="0" cellspacing="5" cellpadding="0">
                <tr>
                    <td class="list_head">No.</td>
                    <td class="list_head">Title</td>
                    <td class="list_head">Create at</td>
                    <td class="list_head">Category</td>
                </tr>

                <tr><td>&nbsp;</td></tr>

                <?php
                foreach ($this->posts as $post) {
                ?>

                <tr>
                    <td class="list_content"><?php echo $post->postId; ?></td>
                    <td class="list_content">
                        <?php echo $this->link($this->U('post', 'edit', 'admin', array('id' => $post->postId)), $post->postUrlTitle); ?>
                    </td>
                    <td class="list_content"><?php echo $post->postCreatedAt; ?></td>
                    <td class="list_content"><?php echo $post->fetchCategory()->categoryUrlTitle; ?></td>
                    <td class="list_content post_delete">
                        <?php
                        echo $this->link($this->U('post', 'delete', 'admin', array('id' => $post->postId)), 
                                         $this->img('cross_red.jpg', '16', '16', 'delete'),
                                         false,
                                         array('onclick' => 'return confirm(\'Do you really want to delete this post ? (' . $post->postUrlTitle . ')\');'));
                        ?>
                    </td>
                </tr>

                <?php
                }
                ?>

            </table>

        </div>

    <?php
    }
    ?>

</div>